package cn.sylinx.horm.config;

import java.util.Map;

import cn.sylinx.horm.config.specific.SpecificConfig;

public class SingleDataSourceConfig implements Cloneable {
    // 名称
    private String name;
    private String dbtype;
    // 主数据源
    private Boolean primary = false;

//	horm.config.datasource.multids[0].name=ds1
//	horm.config.datasource.multids[0].primary=true
//	horm.config.datasource.multids[0].dbtype=mysql

    private String url;
    private String driver;
    private String username;
    private String password;
    private String pooltype;
    private Map<String, Object> poolConfig;

    private SpecificConfig specificConfig;

//	horm.config.datasource.multids[0].url=jdbc:mysql://127.0.0.1:3306/test1?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
//	horm.config.datasource.multids[0].driver=com.mysql.cj.jdbc.Driver
//	horm.config.datasource.multids[0].username=root
//	horm.config.datasource.multids[0].password=123456
//	horm.config.datasource.multids[0].pooltype=Druid
//	# personalized configuration for different connection pools
//	horm.config.datasource.multids[0].pool-config.maxActive=10

    // 单独数据源个性配置
//	horm.config.datasource.multids[0].specific-config.cache=true
//	horm.config.datasource.multids[0].specific-config.guava-cache-config.expire-after-write=true
//	horm.config.datasource.multids[0].specific-config.guava-cache-config.maximum-size=true
//	horm.config.datasource.multids[0].specific-config.sql-stat-open=false

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getPrimary() {
        return primary;
    }

    public void setPrimary(Boolean primary) {
        this.primary = primary;
    }

    public String getDbtype() {
        return dbtype;
    }

    public void setDbtype(String dbtype) {
        this.dbtype = dbtype;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getDriver() {
        return driver;
    }

    public void setDriver(String driver) {
        this.driver = driver;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPooltype() {
        return pooltype;
    }

    public void setPooltype(String pooltype) {
        this.pooltype = pooltype;
    }

    public Map<String, Object> getPoolConfig() {
        return poolConfig;
    }

    public void setPoolConfig(Map<String, Object> poolConfig) {
        this.poolConfig = poolConfig;
    }

    public SpecificConfig getSpecificConfig() {
        return specificConfig;
    }

    public void setSpecificConfig(SpecificConfig specificConfig) {
        this.specificConfig = specificConfig;
    }

    @Override
    public SingleDataSourceConfig clone() throws CloneNotSupportedException {
        return (SingleDataSourceConfig)super.clone();
    }

    @Override
    public String toString() {
        return "SingleDataSourceConfig [name=" + name + ", dbtype=" + dbtype + ", primary=" + primary + ", url=" + url
                + ", driver=" + driver + ", username=" + username + ", password=" + password + ", pooltype=" + pooltype
                + ", poolConfig=" + poolConfig + ", specificConfig=" + specificConfig + "]";
    }

}